package com.shop.controller;


import com.shop.entity.BulkGoodsDetail;
import com.shop.entity.BulkMerchant;
import com.shop.model.PageParam;
import com.shop.model.vo.Rsp;
import com.shop.service.BulkMerchantService;
import lombok.AllArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * 商品批发表
 * gaodo(BulkMerchant)表控制层
 *
 * @author makejava
 * @since 2020-11-26 20:07:04
 */
@Validated
@RestController
@RequestMapping("bulkMerchant")
@AllArgsConstructor
public class BulkMerchantController {
    /**
     * 服务对象
     */
    private final BulkMerchantService bulkMerchantService;

    //获取商户订单
    @PostMapping("getBulkMerchantPage")
    public Rsp getBulkMerchantPage(@RequestHeader("userId") String userId, @RequestBody PageParam<BulkMerchant> pageParam) {
        return Rsp.success(bulkMerchantService.getBulkMerchantPage(pageParam,userId));
    }

    //修改配送状态
    @PostMapping("changeStatus")
    public Rsp changeStatus(@RequestBody BulkMerchant bulkMerchant) {
        return bulkMerchantService.changeStatus(bulkMerchant);
    }
    @PostMapping("merchantReturn")
    public Rsp merchantReturn(@RequestBody BulkMerchant bulkMerchant){

        return bulkMerchantService.insertMerchantReturn(bulkMerchant);
    }
    @PostMapping("merchantReturnOne")
    public Rsp merchantReturnOne(@RequestBody BulkGoodsDetail bulkGoodsDetail){

        return bulkMerchantService.merchantReturnOne(bulkGoodsDetail);
    }
}
